﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;

namespace PrinterMonitoringByGPCL
{
    public class GPCLClass
    {
        private const string dllName = "gpcl6dll32.dll";

        /// <summary>
        /// 初始化
        /// </summary>
        /// <param name="pinstance"></param>
        /// <param name="caller_handle"></param>
        /// <returns></returns>
        [DllImport(dllName, EntryPoint = "gsapi_new_instance", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern int gsapi_new_instance(ref IntPtr pInstance, out IntPtr pCaller);

        /// <summary>
        /// 释放
        /// </summary>
        /// <param name="pinstance"></param>
        [DllImport(dllName, EntryPoint = "gsapi_delete_instance", CharSet = CharSet.Ansi)]
        public static extern int gsapi_delete_instance(IntPtr pInstance);

        /// <summary>
        /// 退出
        /// </summary>
        /// <param name="pinstance"></param>
        [DllImport(dllName, EntryPoint = "gsapi_exit", CharSet = CharSet.Ansi)]
        public static extern int gsapi_exit(IntPtr pInstance);

        [DllImport(dllName, EntryPoint = "gsapi_init_with_args", CharSet = CharSet.Ansi)]
        public static extern int gsapi_init_with_args(IntPtr pInstance, int argc, [In, Out] String[] argv);

    }
}
